package com.bckj.fastboot.iot.biz.controller;

import com.bckj.fastboot.core.lang.model.PageResult;
import com.bckj.fastboot.core.page.PageSupport;
import com.bckj.fastboot.iot.api.service.IotDeviceRemoteService;
import com.bckj.fastboot.iot.biz.service.IotDeviceService;
import com.bckj.fastboot.iot.common.dto.query.IotDeviceQuery;
import com.bckj.fastboot.iot.common.dto.request.IotDeviceRequest;
import com.bckj.fastboot.iot.common.dto.response.IotDeviceResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * IotDeviceController
 *
 * @author wfc
 **/
@RestController
@RequiredArgsConstructor
@RequestMapping("iotDevice")
public class IotDeviceController implements IotDeviceRemoteService {

    private final IotDeviceService iotDeviceService;

    @Override
    public boolean save(IotDeviceRequest request) {
        return iotDeviceService.save(request);
    }

    @Override
    public boolean update(IotDeviceRequest request) {
        return iotDeviceService.update(request);
    }

    @Override
    public IotDeviceResponse details(Long id) {
        return iotDeviceService.details(id);
    }

    @Override
    public PageResult<IotDeviceResponse> page(IotDeviceQuery query) {
        return iotDeviceService.page(PageSupport.buildPage(), query);
    }
}
